#ifndef __ENTER_STROY_LAYER__
#define __ENTER_STROY_LAYER__

#include "cocos2d.h"
#include <vector>

USING_NS_CC;
enum SCeneType
{
	None = 0,
	First = 1,
	Second = 2,
	Thrid = 3,
	Four = 4,
	Five = 5,
};

struct Text_Struct
{
	CCSprite* sprite;
	char* url;
};

class Enter_Story_Layer : public CCLayer
{
public:
	Enter_Story_Layer();
	~Enter_Story_Layer();

	virtual bool init();
	CREATE_FUNC(Enter_Story_Layer);

	virtual void update(float second);

private:

	std::vector<Text_Struct> Text_Vector;
	std::vector<CCSprite*> Text_CCSprite_Vector;
	std::vector<char*> Text_Char_Vector;
	CCSprite* First_BackGround;
	CCSprite* Second_BackGround;
	CCSprite* Thrid_BackGround;
	CCSprite* Star_BackGound;
	CCSprite* Light_BackGround;
	CCSprite* Falling_Star_BackGround_One;
	CCSprite* Falling_Star_BackGround_Two;
	CCSprite* Falling_Star_BackGround_Three;
	CCSprite* Falling_Star_BackGround_Four;
	CCSprite* Falling_Star_BackGround_Five;
	CCSprite* Falling_Star_BOOM_BackGround_One;
	CCSprite* Falling_Star_BOOM_BackGround_Two;
	CCSprite* Falling_Star_BOOM_BackGround_Three;

	CCSprite* Stone_Demon_One;
	CCSprite* Stone_Demon_Two;
	CCSprite* Stone_Demon_Three;

	CCSequence* Star_Seq;
	CCSprite* Story_Texts_1;
	CCSprite* Story_Texts_2;
	

	CCSprite* Story_Third_Text_1;
	CCSprite* Story_Third_Text_2;
	CCSprite* Story_Third_Text_3;
	CCSprite* Story_Third_Text_4;
	CCSprite* Story_Third_Text_5;
	CCSprite* Story_Third_Text_6;
	CCSprite* Story_Third_Text_7;
	CCSprite* Story_Third_Text_8;
	CCSprite* Story_Third_Text_9;
	CCSprite* Story_Third_Text_10;
	CCSprite* Fire_BackGround_Sec;
	//CCSprite* Fire_Wood_BackGround_Sec;
	//CCSprite* Camp_BackGround_Sec;
	CCSprite* Mt_BackGround_Sec;
	CCSprite* xd_BackGround_Sec;
	CCSprite* sm_BackGround_Sec;

	CCSprite* Four_Fire;
	CCSprite* Black_BackGround_Third;

	void Show_First_Text(float dt);
	void Show_Second_Text(float dt);

	void Show_Text_Sec_1(float dt);
	void Show_Text_Sec_2(float dt);
	void Show_Text_Sec_3(float dt);
	void Show_Text_Sec_4(float dt);
	void Show_Text_Sec_5(float dt);
	void Show_Text_Sec_6(float dt);


	CCSprite* Story_Texts_Sec_1;
	CCSprite* Story_Texts_Sec_2;
	CCSprite* Story_Texts_Sec_3;
	CCSprite* Story_Texts_Sec_4;
	CCSprite* Story_Texts_Sec_5;
	CCSprite* Story_Texts_Sec_6;


	CCSprite* Story_Show_TextBox_1;
	CCSprite* Story_Show_TextBox_2;
	CCSprite* Story_Show_TextBox_3;
	CCSprite* Story_Show_TextBox_4;
	CCSprite* Story_Show_TextBox_5;
	CCSprite* Story_Show_TextBox_6;


	void SnakeHead(CCSprite*& pCCSprite);
	void ShowTextBox(CCSprite*& pCCSprite, const char* pszName, CCPoint pPoint);
	void Begin_First_Scene();
	void End_First_Scene(float ptime);
	void Begin_Second_Scene();
	void End_Second_Scene(float ptime);
	void Begin_Third_Scene();
	void End_Thrid_Scene(float ptime);
	void Begin_Four_Scene();
	void End_Four_Scene(float ptime);
	void Begin_Five_Scene();
	void End_Five_Scene(float ptime);
	void Remove_Text(CCNode* pNode, void* data);
	void Show_Text(CCSprite*& pSprite, const char* pszName, float delaytime = 0.1f, CCPoint initpostion = ccp(20, 80), CCPoint movepostion = ccp(0, 80), bool IsDesapper = true);
	void pass_story(CCObject* pSender);
	void Star_Flashing();
	void Show_Text_Thrid(CCSprite* pCCSprite, const char* pszName,float delay);

	float m_floatx;
	float m_floaty;
	float CreateStoneDemonTimer;
	float m_Load_Star_Timer;
	float m_Shining_Timer;


	bool CanDoStarActionOne;
	bool CanDoStarActionTwo;
	bool CanDoStarActionThree;

	bool CanStartThirdText;
	bool CanCreateTextBackGround;
	bool CanCreateStoneDemons;
	int m_CreateCount;
	int Thrid_Text_Count;
	float Thrid_Text_Timer;
	SCeneType SenceNow;
};


#endif